<?php

function parse_file($file,$line){
    $temp = [];
    $han = file($file);
    for ($i = $line - 5;$i < $line + 4;$i ++){
        $temp[$i - 1] = $han[$i - 1];
    }
    return $temp;
}

?>
<!DOCTYPE html>
<html>
<head>
	<title>发生错误了</title>
	<style type="text/css">
		html,body{width: 100%;margin: 0;padding: 0;}
		.title {width: 100%;padding: 6px 10px;background-color: #FFCCFF;margin: 0 auto;}
        .title h1 {margin-left: 20px;}
        li {list-style: none}
        .codeline {width: 100%;border: 1px solid #000;background: #000;}
        .codeline ul{margin-left: 40px;background: ghostwhite;width: 90%;margin: 10px auto;height: 180px;}
        .codeline div.file {background: gray;color: white;margin: 10px auto 0 auto;width: 90%;}
        li.red {background-color: #FF6666;}
	</style>
</head>
<body>

	<div class="title">
        <h4><?php echo $info;?></h4>
		<h1><?php echo $message;?><h1>
	</div>
	<div class="msginfo">
		<div class="codeline">
            <div class="file"><?php echo $file;?>(<?php echo $line;?>)</div>
			<ul>
                <?php $tag = parse_file($file,$line);?>
                <?php foreach ($tag as $k => $v):?>
                    <li class="<?php if ($k == $line - 1): ?>red<?php endif;?>"><code><?php echo $v;?></code></li>
                <?php endforeach;?>
			</ul>
		</div>
        <div class="other">
            <ul>
                <?php foreach ($trace as $k): ?>
                    <li><?php echo $k;?></li>
                <?php endforeach;?>
            </ul>
        </div>
	</div>
</body>
</html>